package com.zyf.project.kvdb.protocol.proto.impl;

import com.zyf.project.kvdb.protocol.proto.ClusterItem;

import java.util.Arrays;

/**
 * <h1>数据库集群配置项</h1>
 * <p>实现了 {@link ClusterItem} 项</p>
 *
 * @author Zhou Yifan
 */
public class KVDBClusterItem implements ClusterItem {

    /**
     * 配置名
     */
    private String name;

    /**
     * 配置 urls
     */
    private String[] urls;

    public KVDBClusterItem(String name, String[] urls) {
        this.name = name;
        this.urls = urls;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setUrls(String[] urls) {
        this.urls = urls;
    }

    /**
     * 配置名
     *
     * @return 配置名
     */
    @Override
    public String getName() {
        return name;
    }

    /**
     * 配置的 URL 字符串数组
     *
     * @return 字符串数组
     */
    @Override
    public String[] getURLs() {
        return urls;
    }

    @Override
    public String toString() {
        return "KVDBClusterItem{" +
                "name='" + name + '\'' +
                ", urls=" + Arrays.toString(urls) +
                '}';
    }
}
